﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace geetol.sms.api.MyContorl
{
    public partial class smsContent : UserControl
    {
        public string smsKey { set { label1.Text = value; } get { return label1.Text; } }
        public string smsValue { set { label2.Text = value; } get { return label2.Text; } }
        public bool isTrigger { set { checkBox1.Checked = value; } get { return checkBox1.Checked; } }

        public smsContent()
        {
            InitializeComponent();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            new editSmsContent(this.smsKey, this.smsValue).Show();
        }

        public void BindingTriggerChange()
        {
            checkBox1.CheckedChanged += CheckBox1_CheckedChanged;
        }

        private void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            var d = sysvar.smsContent.FirstOrDefault(o => o.smskey == smsKey);
            d.smsSend = checkBox1.Checked;
            sysvar.smsContentChange();
        }
    }
}
